package com.maserb.monitor.thymeleaf;

import com.maserb.monitor.service.common.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.thymeleaf.spring5.view.ThymeleafViewResolver;

import java.util.HashMap;
import java.util.Map;

@Configuration
public class TemplateEngineConfig {
    @Autowired
    private void configureThymeleafStaticVars(ThymeleafViewResolver viewResolver) {
        if (viewResolver != null) {
            Map<String, Object> vars = new HashMap<String, Object>();
            vars.put("downloadUrl", "/file/downloadImage/");
            viewResolver.setStaticVariables(vars);
        }
    }
}